<?php
/**
 * Created by Command.
 * User: Vito
 */

namespace app\admin\curd\room;

use app\common\curd\Update;
use app\model\Building;

class RoomUpdate extends Update
{
    //验证器
    protected $validate = [];
    //允许新增的数据字段
    protected $field = [];
    //获取对象时追加的字段
    protected $appendField = [];
    //排除的数据
    protected $exclude = [];
    //条件
    protected $where = [];

    protected function saveMiddleware($next, $model, $params)
    {

        // halt($params);
        $where['id'] = $params['building_number'];
        $params['housing_id'] = Building::where($where)->value('housing_id');
        return $next($model, $params);
    }  
}